package com.ymatou.iapi.exp.testcase;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import com.google.gson.JsonObject;
import com.ymatou.iapi.exp.parameter.AddUserExpBean;
import com.ymatou.iapi.exp.service.AddUserExpCall;
import com.ymatou.iapi.userregister.parameter.UserRegisterInfoRequestDtoBean;
import com.ymatou.iapi.userregister.service.UserRegisterInfoRequestDtoCall;
import com.ymt.core.tool.Logger;
import com.ymt.utils.annotation.*;
import com.ymt.utils.tag.*;
import com.ymttest.business.service.ExpCallService;
import com.ymttest.business.service.JUserCallService;
import com.ymttest.database.model.FestivalRateConfig;
import com.ymttest.database.model.UserExp;
import com.ymttest.database.model.UserExpDetail;
import com.ymttest.database.sqlwapper.ExpWapper;
import com.ymttest.utils.YMTDateUtil;
/**
*增加用户经验值
*FreeMaker Template自动生成代码
*/
@TestSuite
public class Ts_AddUserExp{
	private static AddUserExpBean adduserexpBean;
	private static AddUserExpCall adduserexpCall;
	@BeforeClass
	public static void setUp() {
		Logger.createResultFile("增加用户经验值");
	}

	@Before
	public void caseUp() {
		adduserexpBean=new AddUserExpBean();
		adduserexpCall=new AddUserExpCall();
		resetFestivalRateConfig(1.0,false);
	}

	@AfterClass
	public static void tearDown() {
		Logger.generateResult(adduserexpCall.getOpurl());
	}

	@After
	public void caseDown() {
		Logger.end();
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_AddUserExp_001() {
		Logger.start(true,"增加用户经验值成功");
		try {
			UserRegisterInfoRequestDtoBean regbean = JUserCallService.initUserRegisterInfoRequestDtoBean();
			UserRegisterInfoRequestDtoCall urrc = JUserCallService.UserRegisterInfoRequestDtoCall(regbean);
			
			JsonObject registerResult = urrc.getJsonObject().get("Result").getAsJsonObject();
			String token=registerResult.get("Token").getAsString();
			int uid  = urrc.getUserid();
			ExpWapper ew = new ExpWapper();
			ExpCallService.resetExp(uid, 0);
			adduserexpBean.setUserId(uid);
			adduserexpBean.setBizCode("100101");
			adduserexpBean.setBizNo(YMTDateUtil.getSysTime("yyyyMMdd"));
			adduserexpCall.setData(adduserexpBean);
			adduserexpCall.callService();
			Logger.verifyEquals("success", adduserexpCall.getErrorMessage(), "验证errormessage");
			Logger.verifyEquals("true", adduserexpCall.getSuccess(), "验证success");
			Logger.verifyEquals("0", adduserexpCall.getErrorCode(), "验证ErrorCode");
			Thread.sleep(2000);
			int rexp=adduserexpCall.getJsonObject().getAsJsonObject("result").get("exp").getAsInt();
			Logger.verifyEquals(10, rexp, "验证返回报文exp");
			Thread.sleep(1000);
			UserExp exp = ew.selectuserexp(uid).get(0);
			Logger.verifyEquals(10, exp.getExp(), "验证exp");
			UserExpDetail expd = ew.selectuserexpdetail(uid, null, null, null).get(0);
			Logger.verifyEquals(10, expd.getExp(), "验证expdetail");
			Logger.verifyEquals(adduserexpBean.getBizCode(), expd.getBizCode().toString(), "验证BizCode");
			Logger.verifyEquals(adduserexpBean.getBizNo(), expd.getBizNo(), "验证BizNo");
			Logger.verifyEquals(adduserexpBean.getBizNo(), expd.getOriginalNo(), "验证OriginalNo");
			Logger.verifyEquals(1, expd.getOperateType(), "验证OperateType1增加");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P3.class})
	@TestCase
	public void Tc_AddUserExp_002() {
		Logger.start(true,"不输入uid失败");
		try {
//			ExpWapper ew = new ExpWapper();
//			Logger.comment("初始化数据");
//			ew.deleteuserexp(1);
//			ew.deleteuserexpdetail(1, null, null, null);
//			adduserexpBean.setUserId(1);
			adduserexpBean.setBizCode("100101");
			adduserexpBean.setBizNo(YMTDateUtil.getSysTime("yyyyMMdd"));
			adduserexpCall.setData(adduserexpBean);
			adduserexpCall.callService();
			Logger.verifyEquals("UserId不能小于0！", adduserexpCall.getErrorMessage(), "验证errormessage");
			Logger.verifyEquals("false", adduserexpCall.getSuccess(), "验证success");
			Logger.verifyEquals("2", adduserexpCall.getErrorCode(), "验证ErrorCode");
//			UserExp exp = ew.selectuserexp(1).get(0);
//			Logger.verifyEquals(10, exp.getExp(), "验证exp");
//			UserExpDetail expd = ew.selectuserexpdetail(1, null, null, null).get(0);
//			Logger.verifyEquals(10, expd.getExp(), "验证expdetail");
//			Logger.verifyEquals(adduserexpBean.getBizCode(), expd.getBizCode().toString(), "验证BizCode");
//			Logger.verifyEquals(adduserexpBean.getBizNo(), expd.getBizNo(), "验证BizNo");
//			Logger.verifyEquals(adduserexpBean.getBizNo(), expd.getOriginalNo(), "验证OriginalNo");
//			Logger.verifyEquals(1, expd.getOperateType(), "验证OperateType1增加");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P3.class})
	@TestCase
	public void Tc_AddUserExp_003() {
		Logger.start(true,"不输入bizcode失败");
		try {
			adduserexpBean.setUserId(1);
//			adduserexpBean.setBizCode("100101");
			adduserexpBean.setBizNo(YMTDateUtil.getSysTime("yyyyMMdd"));
			adduserexpCall.setData(adduserexpBean);
			adduserexpCall.callService();
			Logger.verifyIsContains("没有找到bizCode", adduserexpCall.getErrorMessage(), "验证errormessage");
			Logger.verifyEquals("false", adduserexpCall.getSuccess(), "验证success");
			Logger.verifyEquals("2", adduserexpCall.getErrorCode(), "验证ErrorCode");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P3.class})
	@TestCase
	public void Tc_AddUserExp_004() {
		Logger.start(true,"不输入bizno失败");
		try {
			adduserexpBean.setUserId(1);
			adduserexpBean.setBizCode("100101");
//			adduserexpBean.setBizNo(YMTDateUtil.getSysTime("yyyyMMdd"));
			adduserexpCall.setData(adduserexpBean);
			adduserexpCall.callService();
			Logger.verifyEquals("bizNo不能为空！", adduserexpCall.getErrorMessage(), "验证errormessage");
			Logger.verifyEquals("false", adduserexpCall.getSuccess(), "验证success");
			Logger.verifyEquals("2", adduserexpCall.getErrorCode(), "验证ErrorCode");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P3.class})
	@TestCase
	public void Tc_AddUserExp_005() {
		Logger.start(true,"输入错误的uid失败");
		try {
			adduserexpBean.setUserId(-1);
			adduserexpBean.setBizCode("100101");
			adduserexpBean.setBizNo(YMTDateUtil.getSysTime("yyyyMMdd"));
			adduserexpCall.setData(adduserexpBean);
			adduserexpCall.callService();
			Logger.verifyEquals("UserId不能小于0！", adduserexpCall.getErrorMessage(), "验证errormessage");
			Logger.verifyEquals("false", adduserexpCall.getSuccess(), "验证success");
			Logger.verifyEquals("2", adduserexpCall.getErrorCode(), "验证ErrorCode");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P3.class})
	@TestCase
	public void Tc_AddUserExp_006() {
		Logger.start(true,"输入错误的bizcode失败");
		try {
			adduserexpBean.setUserId(1);
			adduserexpBean.setBizCode("-100101");
			adduserexpBean.setBizNo(YMTDateUtil.getSysTime("yyyyMMdd"));
			adduserexpCall.setData(adduserexpBean);
			adduserexpCall.callService();
			Logger.verifyIsContains("没有找到bizCode", adduserexpCall.getErrorMessage(), "验证errormessage");
			Logger.verifyEquals("false", adduserexpCall.getSuccess(), "验证success");
			Logger.verifyEquals("2", adduserexpCall.getErrorCode(), "验证ErrorCode");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P2.class})
	@TestCase
	@Ignore //和case 1重复
	public void Tc_AddUserExp_007() {
		Logger.start(true,"打开APP获得经验值成功");
		try {
			ExpWapper ew = new ExpWapper();
			ExpCallService.resetExp(1, 0);
			adduserexpBean.setUserId(1);
			adduserexpBean.setBizCode("100101");
			adduserexpBean.setBizNo(YMTDateUtil.getSysTime("yyyyMMdd"));
			adduserexpCall.setData(adduserexpBean);
			adduserexpCall.callService();
			Logger.verifyEquals("success", adduserexpCall.getErrorMessage(), "验证errormessage");
			Logger.verifyEquals("true", adduserexpCall.getSuccess(), "验证success");
			Logger.verifyEquals("0", adduserexpCall.getErrorCode(), "验证ErrorCode");
			int rexp=adduserexpCall.getJsonObject().getAsJsonObject("result").get("exp").getAsInt();
			Logger.verifyEquals(10, rexp, "验证返回报文exp");
			UserExp exp = ew.selectuserexp(1).get(0);
			Logger.verifyEquals(10, exp.getExp(), "验证exp");
			UserExpDetail expd = ew.selectuserexpdetail(1, null, null, null).get(0);
			Logger.verifyEquals(10, expd.getExp(), "验证expdetail");
			Logger.verifyEquals(adduserexpBean.getBizCode(), expd.getBizCode().toString(), "验证BizCode");
			Logger.verifyEquals(adduserexpBean.getBizNo(), expd.getBizNo(), "验证BizNo");
			Logger.verifyEquals(adduserexpBean.getBizNo(), expd.getOriginalNo(), "验证OriginalNo");
			Logger.verifyEquals(1, expd.getOperateType(), "验证OperateType1增加");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P2.class})
	@TestCase
	public void Tc_AddUserExp_008() {
		Logger.start(true,"打开APP获得经验值,重复传入bizno日期成功");
		try {
			UserRegisterInfoRequestDtoBean regbean = JUserCallService.initUserRegisterInfoRequestDtoBean();
			UserRegisterInfoRequestDtoCall urrc = JUserCallService.UserRegisterInfoRequestDtoCall(regbean);
			
			JsonObject registerResult = urrc.getJsonObject().get("Result").getAsJsonObject();
			String token=registerResult.get("Token").getAsString();
			int uid  = urrc.getUserid();
			ExpWapper ew = new ExpWapper();
			ExpCallService.resetExp(uid, 0);
			adduserexpBean.setUserId(uid);
			adduserexpBean.setBizCode("100101");
			adduserexpBean.setBizNo(YMTDateUtil.getSysTime("yyyyMMdd"));
			adduserexpCall.setData(adduserexpBean);
			adduserexpCall.callService();
			adduserexpCall.callService();
			Logger.verifyEquals("true", adduserexpCall.getSuccess(), "验证success");
			int rexp=adduserexpCall.getJsonObject().getAsJsonObject("result").get("exp").getAsInt();
			//第二次没有增加exp
			Logger.verifyEquals(0, rexp, "验证exp");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P2.class})
	@TestCase
	public void Tc_AddUserExp_009() {
		Logger.start(true,"打开APP获得经验值,传入bizno日期格式不正确,失败");
		try {
			ExpWapper ew = new ExpWapper();
			ExpCallService.resetExp(1, 0);
			adduserexpBean.setUserId(1);
			adduserexpBean.setBizCode("100101");
			adduserexpBean.setBizNo("yyyyMMdd");
			adduserexpCall.setData(adduserexpBean);
			adduserexpCall.callService();
			Logger.verifyEquals("bizNo的日期格式输入有误！", adduserexpCall.getErrorMessage(), "验证errormessage");
			Logger.verifyEquals("false", adduserexpCall.getSuccess(), "验证success");
			Logger.verifyEquals("2", adduserexpCall.getErrorCode(), "验证ErrorCode");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P2.class})
	@TestCase
	public void Tc_AddUserExp_010() {
		Logger.start(true,"购买商品获得经验值isSubmit=true,经验值发放成功,倍率rate=1");
		try {
			ExpWapper ew = new ExpWapper();
			ExpCallService.resetExp(1, 0);
			adduserexpBean.setUserId(1);
			adduserexpBean.setBizCode("100102");
			adduserexpBean.setBizNo(YMTDateUtil.getSysTime("yyyyMMddHHmmssSSS"));
			Map parameters=new HashMap<>();
			parameters.put("isSubmit", true);
			parameters.put("totalPrice",101);
			adduserexpBean.setParameters(parameters);
			adduserexpCall.setData(adduserexpBean);
			adduserexpCall.callService();
			Logger.verifyEquals("success", adduserexpCall.getErrorMessage(), "验证errormessage");
			Logger.verifyEquals("true", adduserexpCall.getSuccess(), "验证success");
			Logger.verifyEquals("0", adduserexpCall.getErrorCode(), "验证ErrorCode");
			int rexp=adduserexpCall.getJsonObject().getAsJsonObject("result").get("exp").getAsInt();
			Logger.verifyEquals(parameters.get("totalPrice"), rexp, "验证返回报文exp");
			UserExp exp = ew.selectuserexp(1).get(0);
			Logger.verifyEquals(parameters.get("totalPrice"), exp.getExp(), "验证exp");
			UserExpDetail expd = ew.selectuserexpdetail(1, null, null, null).get(0);
			Logger.verifyEquals(parameters.get("totalPrice"), expd.getExp(), "验证expdetail");
			Logger.verifyEquals(adduserexpBean.getBizCode(), expd.getBizCode().toString(), "验证BizCode");
			Logger.verifyEquals(adduserexpBean.getBizNo(), expd.getBizNo(), "验证BizNo");
			Logger.verifyEquals(adduserexpBean.getBizNo(), expd.getOriginalNo(), "验证OriginalNo");
			Logger.verifyEquals(1, expd.getOperateType(), "验证OperateType1增加");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P2.class})
	@TestCase
	public void Tc_AddUserExp_011() {
		Logger.start(true,"购买商品获得经验值isSubmit=false,预算本次可获得的经验值");
		try {
			ExpWapper ew = new ExpWapper();
			
			ExpCallService.resetExp(1, 30);
			
			adduserexpBean.setUserId(1);
			adduserexpBean.setBizCode("100102");
			adduserexpBean.setBizNo(YMTDateUtil.getSysTime("yyyyMMddHHmmssSSS"));
			Map parameters=new HashMap<>();
			parameters.put("isSubmit", false);
			parameters.put("totalPrice",101);
			adduserexpBean.setParameters(parameters);
			adduserexpCall.setData(adduserexpBean);
			adduserexpCall.callService();
			Logger.verifyEquals("success", adduserexpCall.getErrorMessage(), "验证errormessage");
			Logger.verifyEquals("true", adduserexpCall.getSuccess(), "验证success");
			Logger.verifyEquals("0", adduserexpCall.getErrorCode(), "验证ErrorCode");
			int rexp=adduserexpCall.getJsonObject().getAsJsonObject("result").get("exp").getAsInt();
			Logger.verifyEquals(parameters.get("totalPrice"), rexp, "验证返回报文exp");
			UserExp exp = ew.selectuserexp(1).get(0);
			Logger.verifyEquals(30, exp.getExp(), "验证exp");
			int size = ew.selectuserexpdetail(1, null, adduserexpBean.getBizNo(), null).size();
			Logger.verifyEquals(0, size, "验证expdetail没有记录");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P2.class})
	@TestCase
	public void Tc_AddUserExp_012() {
		Logger.start(true,"购买商品获得经验值totalPrice参数错误,失败");
		try {
			ExpWapper ew = new ExpWapper();
			Logger.comment("初始化数据");
			
			ExpCallService.resetExp(1, 30);
			
			adduserexpBean.setUserId(1);
			adduserexpBean.setBizCode("100102");
			adduserexpBean.setBizNo(YMTDateUtil.getSysTime("yyyyMMddHHmmssSSS"));
			Map parameters=new HashMap<>();
			parameters.put("isSubmit", false);
			parameters.put("totalPrice","10.1.1");
			adduserexpBean.setParameters(parameters);
			adduserexpCall.setData(adduserexpBean);
			adduserexpCall.callService();
			Logger.verifyEquals("false", adduserexpCall.getSuccess(), "验证success");
			Logger.verifyEquals("2", adduserexpCall.getErrorCode(), "验证ErrorCode");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P2.class})
	@TestCase
	public void Tc_AddUserExp_013() {
		Logger.start(true,"主动评价订单isSubmit=true,isContainImageText=true获得经验值成功,倍率rate=0.2");
		try {
			ExpWapper ew = new ExpWapper();
			ExpCallService.resetExp(1, 0);
			adduserexpBean.setUserId(1);
			adduserexpBean.setBizCode("100104");
			adduserexpBean.setBizNo(YMTDateUtil.getSysTime("yyyyMMddHHmmssSSS"));
			Map parameters=new HashMap<>();
			parameters.put("isSubmit", true);
			parameters.put("isContainImageText", true);
			parameters.put("totalPrice",50);
			adduserexpBean.setParameters(parameters);
			adduserexpCall.setData(adduserexpBean);
			adduserexpCall.callService();
			Logger.verifyEquals("success", adduserexpCall.getErrorMessage(), "验证errormessage");
			Logger.verifyEquals("true", adduserexpCall.getSuccess(), "验证success");
			Logger.verifyEquals("0", adduserexpCall.getErrorCode(), "验证ErrorCode");
			Double rexp=adduserexpCall.getJsonObject().getAsJsonObject("result").get("exp").getAsDouble();
			Logger.verifyEquals((int)parameters.get("totalPrice")*0.2, rexp, "验证返回报文exp");
			UserExp exp = ew.selectuserexp(1).get(0);
			Logger.verifyEquals((int)parameters.get("totalPrice")*0.2, Double.valueOf(exp.getExp()), "验证exp");
			UserExpDetail expd = ew.selectuserexpdetail(1, null, null, null).get(0);
			Logger.verifyEquals((int)parameters.get("totalPrice")*0.2, Double.valueOf(expd.getExp()), "验证expdetail");
			Logger.verifyEquals(adduserexpBean.getBizCode(), expd.getBizCode().toString(), "验证BizCode");
			Logger.verifyEquals(adduserexpBean.getBizNo(), expd.getBizNo(), "验证BizNo");
			Logger.verifyEquals(adduserexpBean.getBizNo(), expd.getOriginalNo(), "验证OriginalNo");
			Logger.verifyEquals(1, expd.getOperateType(), "验证OperateType1增加");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P2.class})
	@TestCase
	public void Tc_AddUserExp_014() {
		Logger.start(true,"主动评价订单totalPrice参数错误,失败");
		try {
			ExpWapper ew = new ExpWapper();
			ExpCallService.resetExp(1, 0);
			adduserexpBean.setUserId(1);
			adduserexpBean.setBizCode("100104");
			adduserexpBean.setBizNo(YMTDateUtil.getSysTime("yyyyMMddHHmmssSSS"));
			Map parameters=new HashMap<>();
			parameters.put("isSubmit", true);
			parameters.put("isContainImageText", true);
			parameters.put("totalPrice","0.0.0");
			adduserexpBean.setParameters(parameters);
			adduserexpCall.setData(adduserexpBean);
			adduserexpCall.callService();
			Logger.verifyEquals("false", adduserexpCall.getSuccess(), "验证success");
			Logger.verifyEquals("2", adduserexpCall.getErrorCode(), "验证ErrorCode");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P2.class})
	@TestCase
	public void Tc_AddUserExp_015() {
		Logger.start(true,"主动评价订单不包含图文isContainImageText=false不获取经验值");
		try {
			ExpWapper ew = new ExpWapper();
			ExpCallService.resetExp(1, 0);
			adduserexpBean.setUserId(1);
			adduserexpBean.setBizCode("100104");
			adduserexpBean.setBizNo(YMTDateUtil.getSysTime("yyyyMMddHHmmssSSS"));
			Map parameters=new HashMap<>();
			parameters.put("isSubmit", true);
			parameters.put("isContainImageText", false);
			parameters.put("totalPrice",100);
			adduserexpBean.setParameters(parameters);
			adduserexpCall.setData(adduserexpBean);
			adduserexpCall.callService();
			Logger.verifyEquals("success", adduserexpCall.getErrorMessage(), "验证errormessage");
			Logger.verifyEquals("true", adduserexpCall.getSuccess(), "验证success");
			Logger.verifyEquals("0", adduserexpCall.getErrorCode(), "验证ErrorCode");
			Double rexp=adduserexpCall.getJsonObject().getAsJsonObject("result").get("exp").getAsDouble();
			Logger.verifyEquals(0d, rexp, "验证返回报文exp");
			int sizeexp = ew.selectuserexp(1).size();
			Logger.verifyEquals(0, sizeexp, "验证exp不记录当前数据");
			int sizeexpd= ew.selectuserexpdetail(1, null, adduserexpBean.getBizNo(), null).size();
			Logger.verifyEquals(0, sizeexpd, "验证expdetail不记录当前数据");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P2.class})
	@TestCase
	public void Tc_AddUserExp_016() {
		Logger.start(true,"主动评价订单isSubmit=false,预算本次可获得的经验值");
		try {
			ExpWapper ew = new ExpWapper();
			ExpCallService.resetExp(1, 0);
			adduserexpBean.setUserId(1);
			adduserexpBean.setBizCode("100104");
			adduserexpBean.setBizNo(YMTDateUtil.getSysTime("yyyyMMddHHmmssSSS"));
			Map parameters=new HashMap<>();
			parameters.put("isSubmit", false);
			parameters.put("isContainImageText", true);
			parameters.put("totalPrice",100);
			adduserexpBean.setParameters(parameters);
			adduserexpCall.setData(adduserexpBean);
			adduserexpCall.callService();
			Logger.verifyEquals("success", adduserexpCall.getErrorMessage(), "验证errormessage");
			Logger.verifyEquals("true", adduserexpCall.getSuccess(), "验证success");
			Logger.verifyEquals("0", adduserexpCall.getErrorCode(), "验证ErrorCode");
			Double rexp=adduserexpCall.getJsonObject().getAsJsonObject("result").get("exp").getAsDouble();
			Logger.verifyEquals((int)parameters.get("totalPrice")*0.2, rexp, "验证返回报文exp");
			int sizeexp = ew.selectuserexp(1).size();
			Logger.verifyEquals(0, sizeexp, "验证exp不记录当前数据");
			int sizeexpd= ew.selectuserexpdetail(1, null, adduserexpBean.getBizNo(), null).size();
			Logger.verifyEquals(0, sizeexpd, "验证expdetail不记录当前数据");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P2.class})
	@TestCase
	public void Tc_AddUserExp_017() {
		Logger.start(true,"订单取消扣除经验值成功,全部退款");
		try {
			ExpWapper ew = new ExpWapper();
			ExpCallService.resetExp(1, 0);
			AddUserExpBean adduserexpBean1 = ExpCallService.addExp(1, 150);
			Thread.sleep(1000);
			adduserexpBean.setUserId(adduserexpBean1.getUserId());
			adduserexpBean.setBizCode("100202");
			adduserexpBean.setBizNo(adduserexpBean1.getBizNo());
//			Map parameters=new HashMap<>();
//			parameters.put("isSubmit", true);
//			parameters.put("totalPrice",101);
//			adduserexpBean.setParameters(parameters);
			adduserexpCall.setData(adduserexpBean);
			adduserexpCall.callService();
			Logger.verifyEquals("success", adduserexpCall.getErrorMessage(), "验证errormessage");
			Logger.verifyEquals("true", adduserexpCall.getSuccess(), "验证success");
			Logger.verifyEquals("0", adduserexpCall.getErrorCode(), "验证ErrorCode");
			int rexp=adduserexpCall.getJsonObject().getAsJsonObject("result").get("exp").getAsInt();
			Logger.verifyEquals((int)adduserexpBean1.getParameters().get("totalPrice")*-1, rexp, "验证返回报文exp");
			UserExp exp = ew.selectuserexp(1).get(0);
			Logger.verifyEquals(0, exp.getExp(), "验证exp");
			UserExpDetail expd = ew.selectuserexpdetail(1, null, null, null).get(0);
			Logger.verifyEquals((int)adduserexpBean1.getParameters().get("totalPrice")*-1, expd.getExp(), "验证expdetail");
			Logger.verifyEquals(adduserexpBean.getBizCode(), expd.getBizCode().toString(), "验证BizCode");
			Logger.verifyEquals(adduserexpBean.getBizNo(), expd.getBizNo(), "验证BizNo");
			Logger.verifyEquals(adduserexpBean.getBizNo(), expd.getOriginalNo(), "验证OriginalNo");
			Logger.verifyEquals(2, expd.getOperateType(), "验证OperateType2减少");
			
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P2.class})
	@TestCase
	public void Tc_AddUserExp_018() {
		Logger.start(true,"订单取消扣除经验值成功,部分退款");
		try {
			ExpWapper ew = new ExpWapper();
			ExpCallService.resetExp(1, 0);
			AddUserExpBean adduserexpBean1 = ExpCallService.addExp(1, 150);
			Thread.sleep(1000);
			adduserexpBean.setUserId(adduserexpBean1.getUserId());
			adduserexpBean.setBizCode("100202");
			adduserexpBean.setBizNo(adduserexpBean1.getBizNo());
			Map parameters=new HashMap<>();
			parameters.put("specId", YMTDateUtil.getSysTime("yyyyMMddHHmmssSSS"));
			parameters.put("price",70);
			adduserexpBean.setParameters(parameters);
			adduserexpCall.setData(adduserexpBean);
			adduserexpCall.callService();
			Logger.verifyEquals("success", adduserexpCall.getErrorMessage(), "验证errormessage");
			Logger.verifyEquals("true", adduserexpCall.getSuccess(), "验证success");
			Logger.verifyEquals("0", adduserexpCall.getErrorCode(), "验证ErrorCode");
			int rexp=adduserexpCall.getJsonObject().getAsJsonObject("result").get("exp").getAsInt();
			Logger.verifyEquals((int)adduserexpBean.getParameters().get("price")*-1, rexp, "验证返回报文exp");
			UserExp exp = ew.selectuserexp(1).get(0);
			Logger.verifyEquals((int)adduserexpBean1.getParameters().get("totalPrice")+(int)adduserexpBean.getParameters().get("price")*-1, exp.getExp(), "验证exp");
			UserExpDetail expd = ew.selectuserexpdetail(1, null, null, null).get(0);
			Logger.verifyEquals((int)adduserexpBean.getParameters().get("price")*-1, expd.getExp(), "验证expdetail");
			Logger.verifyEquals(adduserexpBean.getBizCode(), expd.getBizCode().toString(), "验证BizCode");
			Logger.verifyEquals(adduserexpBean.getBizNo(), expd.getBizNo(), "验证BizNo");
			Logger.verifyEquals(adduserexpBean.getParameters().get("specId"), expd.getOriginalNo(), "验证OriginalNo");
			Logger.verifyEquals(2, expd.getOperateType(), "验证OperateType2减少");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P2.class})
	@TestCase
	public void Tc_AddUserExp_019() {
		Logger.start(true,"订单取消扣除经验值成功,多次部分退款");
		try {
			ExpWapper ew = new ExpWapper();
			ExpCallService.resetExp(1, 0);
			AddUserExpBean adduserexpBean1 = ExpCallService.addExp(1, 150);
			Thread.sleep(1000);
			adduserexpBean.setUserId(adduserexpBean1.getUserId());
			adduserexpBean.setBizCode("100202");
			adduserexpBean.setBizNo(adduserexpBean1.getBizNo());
			Map parameters=new HashMap<>();
			parameters.put("specId", YMTDateUtil.getSysTime("yyyyMMddHHmmssSSS"));
			parameters.put("price",70);
			adduserexpBean.setParameters(parameters);
			adduserexpCall.setData(adduserexpBean);
			
			Logger.comment("第一次退款");
			
			adduserexpCall.callService();
			
			Logger.verifyEquals("success", adduserexpCall.getErrorMessage(), "验证errormessage");
			Logger.verifyEquals("true", adduserexpCall.getSuccess(), "验证success");
			Logger.verifyEquals("0", adduserexpCall.getErrorCode(), "验证ErrorCode");
			int rexp=adduserexpCall.getJsonObject().getAsJsonObject("result").get("exp").getAsInt();
			
			UserExp exp = ew.selectuserexp(1).get(0);
			Logger.verifyEquals(150-70, exp.getExp(), "验证exp");
			UserExpDetail expd = ew.selectuserexpdetail(1, null, null, null).get(0);
			Logger.verifyEquals(-70, expd.getExp(), "验证expdetail");
			Logger.verifyEquals(adduserexpBean.getBizCode(), expd.getBizCode().toString(), "验证BizCode");
			Logger.verifyEquals(adduserexpBean.getBizNo(), expd.getBizNo(), "验证BizNo");
			Logger.verifyEquals(adduserexpBean.getParameters().get("specId"), expd.getOriginalNo(), "验证OriginalNo");
			Logger.verifyEquals(2, expd.getOperateType(), "验证OperateType2减少");
			
			parameters.put("specId", YMTDateUtil.getSysTime("yyyyMMddHHmmssSSS"));
			parameters.put("price",60);
			adduserexpCall.setData(adduserexpBean);
			
			Thread.sleep(1000);
			Logger.comment("第二次退款");
			
			adduserexpCall.callService();
			Logger.verifyEquals("success", adduserexpCall.getErrorMessage(), "验证errormessage");
			Logger.verifyEquals("true", adduserexpCall.getSuccess(), "验证success");
			Logger.verifyEquals("0", adduserexpCall.getErrorCode(), "验证ErrorCode");
			rexp=adduserexpCall.getJsonObject().getAsJsonObject("result").get("exp").getAsInt();
			Logger.verifyEquals((int)adduserexpBean.getParameters().get("price")*-1, rexp, "验证返回报文exp");
			exp = ew.selectuserexp(1).get(0);
			Logger.verifyEquals(20, exp.getExp(), "验证exp");
			expd = ew.selectuserexpdetail(1, null, null, null).get(0);
			Logger.verifyEquals(-60, expd.getExp(), "验证expdetail");
			Logger.verifyEquals(adduserexpBean.getBizCode(), expd.getBizCode().toString(), "验证BizCode");
			Logger.verifyEquals(adduserexpBean.getBizNo(), expd.getBizNo(), "验证BizNo");
			Logger.verifyEquals(adduserexpBean.getParameters().get("specId"), expd.getOriginalNo(), "验证OriginalNo");
			Logger.verifyEquals(2, expd.getOperateType(), "验证OperateType2减少");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P2.class})
	@TestCase
	public void Tc_AddUserExp_020() {
		Logger.start(true,"订单取消扣除经验值超出获取经验值,失败");
		try {
			ExpWapper ew = new ExpWapper();
			ExpCallService.resetExp(1, 0);
			AddUserExpBean adduserexpBean1 = ExpCallService.addExp(1, 150);
			Thread.sleep(1000);
			adduserexpBean.setUserId(adduserexpBean1.getUserId());
			adduserexpBean.setBizCode("100202");
			adduserexpBean.setBizNo(adduserexpBean1.getBizNo());
			Map parameters=new HashMap<>();
			parameters.put("specId", YMTDateUtil.getSysTime("yyyyMMddHHmmssSSS"));
			parameters.put("price",70);
			adduserexpBean.setParameters(parameters);
			adduserexpCall.setData(adduserexpBean);
			
			Logger.comment("第一次退款");
			
			adduserexpCall.callService();
			
			Logger.verifyEquals("success", adduserexpCall.getErrorMessage(), "验证errormessage");
			Logger.verifyEquals("true", adduserexpCall.getSuccess(), "验证success");
			Logger.verifyEquals("0", adduserexpCall.getErrorCode(), "验证ErrorCode");
			int rexp=adduserexpCall.getJsonObject().getAsJsonObject("result").get("exp").getAsInt();
			
			UserExp exp = ew.selectuserexp(1).get(0);
			Logger.verifyEquals(150-70, exp.getExp(), "验证exp");
			UserExpDetail expd = ew.selectuserexpdetail(1, null, null, null).get(0);
			Logger.verifyEquals(-70, expd.getExp(), "验证expdetail");
			Logger.verifyEquals(adduserexpBean.getBizCode(), expd.getBizCode().toString(), "验证BizCode");
			Logger.verifyEquals(adduserexpBean.getBizNo(), expd.getBizNo(), "验证BizNo");
			Logger.verifyEquals(adduserexpBean.getParameters().get("specId"), expd.getOriginalNo(), "验证OriginalNo");
			Logger.verifyEquals(2, expd.getOperateType(), "验证OperateType2减少");
			
			parameters.put("specId", YMTDateUtil.getSysTime("yyyyMMddHHmmssSSS"));
			parameters.put("price",100);
			adduserexpCall.setData(adduserexpBean);
			
			Thread.sleep(1000);
			Logger.comment("第二次退款");
			
			adduserexpCall.callService();
			Logger.verifyEquals("大于原始获得的经验值！", adduserexpCall.getErrorMessage(), "验证errormessage");
			Logger.verifyEquals("false", adduserexpCall.getSuccess(), "验证success");
			Logger.verifyEquals("3", adduserexpCall.getErrorCode(), "验证ErrorCode");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P2.class})
	@TestCase
	public void Tc_AddUserExp_021() {
		Logger.start(true,"购买商品获得经验值金额小于最小金额阈值20,不获取经验");
		try {
			ExpWapper ew = new ExpWapper();
			Logger.comment("初始化数据");
			ExpCallService.resetExp(1, 20);
			adduserexpBean.setUserId(1);
			adduserexpBean.setBizCode("100102");
			adduserexpBean.setBizNo(YMTDateUtil.getSysTime("yyyyMMddHHmmssSSS"));
			Map parameters=new HashMap<>();
			parameters.put("isSubmit", true);
			parameters.put("totalPrice",10);
			adduserexpBean.setParameters(parameters);
			adduserexpCall.setData(adduserexpBean);
			adduserexpCall.callService();
			Logger.verifyEquals("success", adduserexpCall.getErrorMessage(), "验证errormessage");
			Logger.verifyEquals("true", adduserexpCall.getSuccess(), "验证success");
			Logger.verifyEquals("0", adduserexpCall.getErrorCode(), "验证ErrorCode");
			int rexp=adduserexpCall.getJsonObject().getAsJsonObject("result").get("exp").getAsInt();
			Logger.verifyEquals(0, rexp, "验证返回报文exp");
			UserExp exp = ew.selectuserexp(1).get(0);
			Logger.verifyEquals(20, exp.getExp(), "验证exp");
			int size= ew.selectuserexpdetail(1, null, adduserexpBean.getBizNo(), null).size();
			Logger.verifyEquals(0, size, "验证expdetail不记录当前数据");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P2.class})
	@TestCase
	public void Tc_AddUserExp_022() {
		Logger.start(true,"节日购买商品获得经验值计算节日倍率rate,获取经验正确");
		try {
			ExpWapper ew = new ExpWapper();
			resetFestivalRateConfig(2.0,true);
			
			ExpCallService.resetExp(1, 0);
			adduserexpBean.setUserId(1);
			adduserexpBean.setBizCode("100102");
			adduserexpBean.setBizNo(YMTDateUtil.getSysTime("yyyyMMddHHmmssSSS"));
			Map parameters=new HashMap<>();
			parameters.put("isSubmit", true);
			parameters.put("totalPrice",101);
			adduserexpBean.setParameters(parameters);
			adduserexpCall.setData(adduserexpBean);
			adduserexpCall.callService();
			Logger.verifyEquals("success", adduserexpCall.getErrorMessage(), "验证errormessage");
			Logger.verifyEquals("true", adduserexpCall.getSuccess(), "验证success");
			Logger.verifyEquals("0", adduserexpCall.getErrorCode(), "验证ErrorCode");
			int rexp=adduserexpCall.getJsonObject().getAsJsonObject("result").get("exp").getAsInt();
			Logger.verifyEquals((int)parameters.get("totalPrice")*2, rexp, "验证返回报文exp");
			UserExp exp = ew.selectuserexp(1).get(0);
			Logger.verifyEquals((int)parameters.get("totalPrice")*2, exp.getExp(), "验证exp");
			UserExpDetail expd = ew.selectuserexpdetail(1, null, null, null).get(0);
			Logger.verifyEquals((int)parameters.get("totalPrice")*2, expd.getExp(), "验证expdetail");
			Logger.verifyEquals(adduserexpBean.getBizCode(), expd.getBizCode().toString(), "验证BizCode");
			Logger.verifyEquals(adduserexpBean.getBizNo(), expd.getBizNo(), "验证BizNo");
			Logger.verifyEquals(adduserexpBean.getBizNo(), expd.getOriginalNo(), "验证OriginalNo");
			Logger.verifyEquals(1, expd.getOperateType(), "验证OperateType1增加");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P2.class})
	@TestCase
	public void Tc_AddUserExp_023() {
		Logger.start(true,"节日倍率未启动购买商品经验值按普通倍率计算");
		try {
			ExpWapper ew = new ExpWapper();
			resetFestivalRateConfig(2.0,false);
			ExpCallService.resetExp(1, 0);
			adduserexpBean.setUserId(1);
			adduserexpBean.setBizCode("100102");
			adduserexpBean.setBizNo(YMTDateUtil.getSysTime("yyyyMMddHHmmssSSS"));
			Map parameters=new HashMap<>();
			parameters.put("isSubmit", true);
			parameters.put("totalPrice",101);
			adduserexpBean.setParameters(parameters);
			adduserexpCall.setData(adduserexpBean);
			adduserexpCall.callService();
			Logger.verifyEquals("success", adduserexpCall.getErrorMessage(), "验证errormessage");
			Logger.verifyEquals("true", adduserexpCall.getSuccess(), "验证success");
			Logger.verifyEquals("0", adduserexpCall.getErrorCode(), "验证ErrorCode");
			int rexp=adduserexpCall.getJsonObject().getAsJsonObject("result").get("exp").getAsInt();
			Logger.verifyEquals(parameters.get("totalPrice"), rexp, "验证返回报文exp");
			UserExp exp = ew.selectuserexp(1).get(0);
			Logger.verifyEquals(parameters.get("totalPrice"), exp.getExp(), "验证exp");
			UserExpDetail expd = ew.selectuserexpdetail(1, null, null, null).get(0);
			Logger.verifyEquals(parameters.get("totalPrice"), expd.getExp(), "验证expdetail");
			Logger.verifyEquals(adduserexpBean.getBizCode(), expd.getBizCode().toString(), "验证BizCode");
			Logger.verifyEquals(adduserexpBean.getBizNo(), expd.getBizNo(), "验证BizNo");
			Logger.verifyEquals(adduserexpBean.getBizNo(), expd.getOriginalNo(), "验证OriginalNo");
			Logger.verifyEquals(1, expd.getOperateType(), "验证OperateType1增加");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P2.class})
	@TestCase
	public void Tc_AddUserExp_024() {
		Logger.start(false,"购买商品获得经验值isSubmit为空,失败");
		try {
			ExpWapper ew = new ExpWapper();
			Logger.comment("初始化数据");
			ew.deleteuserexp(1);
			ew.deleteuserexpdetail(1, null, null, null);
			adduserexpBean.setUserId(1);
			adduserexpBean.setBizCode("100102");
			adduserexpBean.setBizNo(YMTDateUtil.getSysTime("yyyyMMddHHmmssSSS"));
			adduserexpCall.setData(adduserexpBean);
			adduserexpCall.callService();
			Logger.verifyEquals("isSubmit参数不能为空！", adduserexpCall.getErrorMessage(), "验证errormessage");
			Logger.verifyEquals("false", adduserexpCall.getSuccess(), "验证success");
			Logger.verifyEquals("2", adduserexpCall.getErrorCode(), "验证ErrorCode");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P2.class})
	@TestCase
	public void Tc_AddUserExp_025() {
		Logger.start(true,"节日购买商品获得经验值计算节日倍率rate后全部取消,扣减经验值正确");
		try {
			ExpWapper ew = new ExpWapper();
			resetFestivalRateConfig(2.0,true);
			ExpCallService.resetExp(1, 0);
			AddUserExpBean adduserexpBean1 = ExpCallService.addExp(1, 150);
			Thread.sleep(1000);
			adduserexpBean.setUserId(adduserexpBean1.getUserId());
			adduserexpBean.setBizCode("100202");
			adduserexpBean.setBizNo(adduserexpBean1.getBizNo());
//			Map parameters=new HashMap<>();
//			parameters.put("isSubmit", true);
//			parameters.put("totalPrice",101);
//			adduserexpBean.setParameters(parameters);
			adduserexpCall.setData(adduserexpBean);
			adduserexpCall.callService();
			Logger.verifyEquals("success", adduserexpCall.getErrorMessage(), "验证errormessage");
			Logger.verifyEquals("true", adduserexpCall.getSuccess(), "验证success");
			Logger.verifyEquals("0", adduserexpCall.getErrorCode(), "验证ErrorCode");
			int rexp=adduserexpCall.getJsonObject().getAsJsonObject("result").get("exp").getAsInt();
			Logger.verifyEquals((int)adduserexpBean1.getParameters().get("totalPrice")*-2, rexp, "验证返回报文exp");
			UserExp exp = ew.selectuserexp(1).get(0);
			Logger.verifyEquals(0, exp.getExp(), "验证exp");
			UserExpDetail expd = ew.selectuserexpdetail(1, null, null, null).get(0);
			Logger.verifyEquals((int)adduserexpBean1.getParameters().get("totalPrice")*-2, expd.getExp(), "验证expdetail");
			Logger.verifyEquals(adduserexpBean.getBizCode(), expd.getBizCode().toString(), "验证BizCode");
			Logger.verifyEquals(adduserexpBean.getBizNo(), expd.getBizNo(), "验证BizNo");
			Logger.verifyEquals(adduserexpBean.getBizNo(), expd.getOriginalNo(), "验证OriginalNo");
			Logger.verifyEquals(2, expd.getOperateType(), "验证OperateType2减少");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P2.class})
	@TestCase
	public void Tc_AddUserExp_026() {
		Logger.start(true,"节日购买商品获得经验值计算节日倍率rate后部分取消,扣减经验值正确");
		try {
			ExpWapper ew = new ExpWapper();
			resetFestivalRateConfig(2.0,true);
			ExpCallService.resetExp(1, 0);
			AddUserExpBean adduserexpBean1 = ExpCallService.addExp(1, 150);
			Thread.sleep(1000);
			adduserexpBean.setUserId(adduserexpBean1.getUserId());
			adduserexpBean.setBizCode("100202");
			adduserexpBean.setBizNo(adduserexpBean1.getBizNo());
			Map parameters=new HashMap<>();
			parameters.put("specId", YMTDateUtil.getSysTime("yyyyMMddHHmmssSSS"));
			parameters.put("price",70);
			adduserexpBean.setParameters(parameters);
			adduserexpCall.setData(adduserexpBean);
			
			Logger.comment("第一次退款");
			
			adduserexpCall.callService();
			
			Logger.verifyEquals("success", adduserexpCall.getErrorMessage(), "验证errormessage");
			Logger.verifyEquals("true", adduserexpCall.getSuccess(), "验证success");
			Logger.verifyEquals("0", adduserexpCall.getErrorCode(), "验证ErrorCode");
			int rexp=adduserexpCall.getJsonObject().getAsJsonObject("result").get("exp").getAsInt();
			
			UserExp exp = ew.selectuserexp(1).get(0);
			Logger.verifyEquals(300-140, exp.getExp(), "验证exp");
			UserExpDetail expd = ew.selectuserexpdetail(1, null, null, null).get(0);
			Logger.verifyEquals(-140, expd.getExp(), "验证expdetail");
			Logger.verifyEquals(adduserexpBean.getBizCode(), expd.getBizCode().toString(), "验证BizCode");
			Logger.verifyEquals(adduserexpBean.getBizNo(), expd.getBizNo(), "验证BizNo");
			Logger.verifyEquals(adduserexpBean.getParameters().get("specId"), expd.getOriginalNo(), "验证OriginalNo");
			Logger.verifyEquals(2, expd.getOperateType(), "验证OperateType2减少");
			
			parameters.put("specId", YMTDateUtil.getSysTime("yyyyMMddHHmmssSSS"));
			parameters.put("price",60);
			adduserexpCall.setData(adduserexpBean);
			
			Thread.sleep(1000);
			Logger.comment("第二次退款");
			
			adduserexpCall.callService();
			Logger.verifyEquals("success", adduserexpCall.getErrorMessage(), "验证errormessage");
			Logger.verifyEquals("true", adduserexpCall.getSuccess(), "验证success");
			Logger.verifyEquals("0", adduserexpCall.getErrorCode(), "验证ErrorCode");
			rexp=adduserexpCall.getJsonObject().getAsJsonObject("result").get("exp").getAsInt();
			Logger.verifyEquals((int)adduserexpBean.getParameters().get("price")*-2, rexp, "验证返回报文exp");
			exp = ew.selectuserexp(1).get(0);
			Logger.verifyEquals(40, exp.getExp(), "验证exp");
			expd = ew.selectuserexpdetail(1, null, null, null).get(0);
			Logger.verifyEquals(-120, expd.getExp(), "验证expdetail");
			Logger.verifyEquals(adduserexpBean.getBizCode(), expd.getBizCode().toString(), "验证BizCode");
			Logger.verifyEquals(adduserexpBean.getBizNo(), expd.getBizNo(), "验证BizNo");
			Logger.verifyEquals(adduserexpBean.getParameters().get("specId"), expd.getOriginalNo(), "验证OriginalNo");
			Logger.verifyEquals(2, expd.getOperateType(), "验证OperateType2减少");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P2.class})
	@TestCase
	public void Tc_AddUserExp_027() {
		Logger.start(false,"没有确认收货订单取消不扣除经验值");
		try {
			ExpWapper ew = new ExpWapper();
			ExpCallService.resetExp(1, 0);
//			AddUserExpBean adduserexpBean1 = ExpCallService.addExp(1, 150);
			adduserexpBean.setUserId(1);
			adduserexpBean.setBizCode("100202");
			adduserexpBean.setBizNo(YMTDateUtil.getSysTime("yyyyMMddHHmmssSSS"));
			Map parameters=new HashMap<>();
			parameters.put("isSubmit", true);
			parameters.put("totalPrice",30);
			adduserexpBean.setParameters(parameters);
//			Map parameters=new HashMap<>();
//			parameters.put("isSubmit", true);
//			parameters.put("totalPrice",101);
//			adduserexpBean.setParameters(parameters);
			adduserexpCall.setData(adduserexpBean);
			adduserexpCall.callService();
			Logger.verifyEquals("success", adduserexpCall.getErrorMessage(), "验证errormessage");
			Logger.verifyEquals("true", adduserexpCall.getSuccess(), "验证success");
			Logger.verifyEquals("0", adduserexpCall.getErrorCode(), "验证ErrorCode");
			int rexp = adduserexpCall.getJsonObject().getAsJsonObject("result").get("exp").getAsInt();
			Logger.verifyEquals(0, rexp, "验证返回报文exp0,没有exp变动");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P2.class})
	@TestCase
	public void Tc_AddUserExp_028() {
		Logger.start(true,"没有确认收货订单部分退款,不扣除经验值");
		try {
			ExpWapper ew = new ExpWapper();
			ExpCallService.resetExp(1, 0);
//			AddUserExpBean adduserexpBean1 = ExpCallService.addExp(1, 150);
			Thread.sleep(1000);
			adduserexpBean.setUserId(1);
			adduserexpBean.setBizCode("100202");
			adduserexpBean.setBizNo(YMTDateUtil.getSysTime("yyyyMMddHHmmssSSS"));
			Map parameters=new HashMap<>();
			parameters.put("specId", YMTDateUtil.getSysTime("yyyyMMddHHmmssSSS"));
			parameters.put("price",70);
			adduserexpBean.setParameters(parameters);
			adduserexpCall.setData(adduserexpBean);
			adduserexpCall.callService();
			Logger.verifyEquals("success", adduserexpCall.getErrorMessage(), "验证errormessage");
			Logger.verifyEquals("true", adduserexpCall.getSuccess(), "验证success");
			Logger.verifyEquals("0", adduserexpCall.getErrorCode(), "验证ErrorCode");
			int rexp = adduserexpCall.getJsonObject().getAsJsonObject("result").get("exp").getAsInt();
			Logger.verifyEquals(0, rexp, "验证返回报文exp0,没有exp变动");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P2.class})
	@TestCase
	public void Tc_AddUserExp_030() {
		Logger.start(true,"订单金额不足20取消扣除经验值不扣除");
		try {
			ExpWapper ew = new ExpWapper();
			ExpCallService.resetExp(1, 0);
			AddUserExpBean adduserexpBean1 = ExpCallService.addExp(1, 10);
			Thread.sleep(1000);
			adduserexpBean.setUserId(adduserexpBean1.getUserId());
			adduserexpBean.setBizCode("100202");
			adduserexpBean.setBizNo(adduserexpBean1.getBizNo());
//			Map parameters=new HashMap<>();
//			parameters.put("isSubmit", true);
//			parameters.put("totalPrice",101);
//			adduserexpBean.setParameters(parameters);
			adduserexpCall.setData(adduserexpBean);
			adduserexpCall.callService();
			Logger.verifyEquals("success", adduserexpCall.getErrorMessage(), "验证errormessage");
			Logger.verifyEquals("true", adduserexpCall.getSuccess(), "验证success");
			Logger.verifyEquals("0", adduserexpCall.getErrorCode(), "验证ErrorCode");
			int rexp = adduserexpCall.getJsonObject().getAsJsonObject("result").get("exp").getAsInt();
			Logger.verifyEquals(0, rexp, "验证返回报文exp0,没有exp变动");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P2.class})
	@TestCase
	public void Tc_AddUserExp_031() {
		Logger.start(true,"主动评价订单金额小于20,不增加经验");
		try {
			ExpWapper ew = new ExpWapper();
			ExpCallService.resetExp(1, 0);
			adduserexpBean.setUserId(1);
			adduserexpBean.setBizCode("100104");
			adduserexpBean.setBizNo(YMTDateUtil.getSysTime("yyyyMMddHHmmssSSS"));
			Map parameters=new HashMap<>();
			parameters.put("isSubmit", true);
			parameters.put("isContainImageText", true);
			parameters.put("totalPrice",10);
			adduserexpBean.setParameters(parameters);
			adduserexpCall.setData(adduserexpBean);
			adduserexpCall.callService();
			Logger.verifyEquals("success", adduserexpCall.getErrorMessage(), "验证errormessage");
			Logger.verifyEquals("true", adduserexpCall.getSuccess(), "验证success");
			Logger.verifyEquals("0", adduserexpCall.getErrorCode(), "验证ErrorCode");
			Double rexp=adduserexpCall.getJsonObject().getAsJsonObject("result").get("exp").getAsDouble();
			Logger.verifyEquals(0d, rexp, "验证返回报文exp");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_AddUserExp_032() {
		Logger.start(true,"节日增加用户签到经验值成功");
		try {
			UserRegisterInfoRequestDtoBean regbean = JUserCallService.initUserRegisterInfoRequestDtoBean();
			UserRegisterInfoRequestDtoCall urrc = JUserCallService.UserRegisterInfoRequestDtoCall(regbean);
			
			JsonObject registerResult = urrc.getJsonObject().get("Result").getAsJsonObject();
			String token=registerResult.get("Token").getAsString();
			int uid  = urrc.getUserid();
			
			ExpWapper ew = new ExpWapper();
			resetFestivalRateConfig(1.2,true);
			ExpCallService.resetExp(uid, 0);
			
			adduserexpBean.setUserId(uid);
			adduserexpBean.setBizCode("100101");
			adduserexpBean.setBizNo(YMTDateUtil.getSysTime("yyyyMMdd"));
			adduserexpCall.setData(adduserexpBean);
			adduserexpCall.callService();
			Logger.verifyEquals("success", adduserexpCall.getErrorMessage(), "验证errormessage");
			Logger.verifyEquals("true", adduserexpCall.getSuccess(), "验证success");
			Logger.verifyEquals("0", adduserexpCall.getErrorCode(), "验证ErrorCode");
			int rexp=adduserexpCall.getJsonObject().getAsJsonObject("result").get("exp").getAsInt();
			Logger.verifyEquals(12, rexp, "验证返回报文exp");
			Thread.sleep(1000);
			UserExp exp = ew.selectuserexp(uid).get(0);
			Logger.verifyEquals(12, exp.getExp(), "验证exp");
			UserExpDetail expd = ew.selectuserexpdetail(uid, null, null, null).get(0);
			Logger.verifyEquals(12, expd.getExp(), "验证expdetail");
			Logger.verifyEquals(adduserexpBean.getBizCode(), expd.getBizCode().toString(), "验证BizCode");
			Logger.verifyEquals(adduserexpBean.getBizNo(), expd.getBizNo(), "验证BizNo");
			Logger.verifyEquals(adduserexpBean.getBizNo(), expd.getOriginalNo(), "验证OriginalNo");
			Logger.verifyEquals(1, expd.getOperateType(), "验证OperateType1增加");
			ExpCallService.resetFestivalRateConfig(1,false);
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	private void resetFestivalRateConfig(double rate,boolean enable){
		Logger.comment("设置节日倍率:"+rate+",是否启用:"+enable);
		ExpWapper ew = new ExpWapper();
		ew.deleteFestivalRateConfig(YMTDateUtil.getSysTime("yyyy-MM-dd"));
		FestivalRateConfig frc=new FestivalRateConfig();
		frc.setCreateTime(YMTDateUtil.getDate());
		frc.setDate(YMTDateUtil.getSysTime("yyyy-MM-dd"));
		frc.setRate(rate);
		frc.setEnable(enable);
		frc.setLastUpdateTime(YMTDateUtil.getDate());
		frc.setRemark("autoTest");
		ew.insertFestivalRateConfig(frc);
	}
}